#include <iostream>

using namespace std;

int sum(int* arr,int arrlen){
	if (arrlen<=1){
		return arr[0];
	}
	int array[arrlen-1];
	for (int i = 1; i<arrlen;i++) {
		array[i-1] = arr[i];
	}
	return arr[0] + sum(array,arrlen-1);
}


int main(){
	int arr[] = {2,4,6};
	cout << sum(arr,3) << endl;
	return 0;	
}
